|
|
|
|
|
|
|
The PaletteMode property determines how the form manages its palette. If this property's value is 2 - Custom, the control uses the palette of the image specified in its Palette property. |
|
|
|
|
|
|
|
|
If PaletteMode is 0 - Halftone, the form uses a halftone palette. That allows the form to display several different images that would like to use different palettes. The results are a bit grainy, but they are better than the garbage you might get if one picture has total control of the system palette. |
|
|
|
|
|
|
|
|
If PaletteMode is 1 - Use ZOrder, the form uses the palette of the control it contains that is on top of the other controls. This setting is particularly useful when the form must display a single image. |
|
|
|
|
|
|
|
|
The Palette and PaletteMode properties have still not really solved the problems you may face working with palettes. They make it easier to do simple things, but they make performing more advanced tasks even more confusing. They help you determine which image has control of the system palette, but they do not help you determine what colors are in the palette. |
|
|
|
|
|
|
|
|
This would be an excellent time to reevaluate your decision to not buy more memory and move to 24-bit color. |
|
|
|
|
|
|
|
|
To make it easier for programs to share the same system palette, Windows reserves several static entries in the system color table. These entries are filled with commonly used colors, such as red, blue, and dark green. These colors include the 16 colors in the Windows 3.0 VGA color palette, plus 4 others. Table 3.2 shows the 20 static colors in the system palette. |
|
|
|
|
|
|
|
|
If your program uses only these static colors, you are almost guaranteed to get exactly the colors you want. If you run many programs that all use the static colors, they can share the same system palette without conflict. Only when you run several applications that use non-static colors will you have color palette conflicts. |
|
|
|
|
|
|
|
|
These static colors are also useful as a last resort for mapping background palette colors. For example, suppose the foreground palette contains only shades of green. If a background palette contains dark pink, Windows can match the color more closely to the static color red than to one of the shades of green defined by the foreground palette. |
|
|
|
|
|
|
|
|
The ordering of the static colors in the system palette is not accidental. If your program sets DrawMode to vbInvert and draws on top of a color, Visual Basic inverts each of the bits representing the color in the system color palette. |
|
|
|
|
|
|
|
|
You can also compute a color's inverted index by subtracting the index from 255. For instance, the previous list shows that the system palette index of the static color green |
|
|
|
|
|